package com.zp.game

import android.content.Context
import android.widget.TextView
import com.helloandroid.AppUtil
import com.helloandroid.MyApplication
import com.helloandroid.R
import com.helloandroid.base.BaseDialog

class PiecesDialog(ctx: Context) : BaseDialog(ctx) {

    private val zpActivity = ctx as ZpGame

    private val WORLD = "碎片x"

    lateinit var tv_1 : TextView
    lateinit var tv_2 : TextView
    lateinit var tv_3 : TextView
    lateinit var tv_4 : TextView
    lateinit var tv_5 : TextView

    override fun getContentViewResId(): Int = R.layout.dialog_zp_pieces

    override fun initView() {
        findBtn(R.id.btnClose).setOnClickListener { cancel() }

        findBtn(R.id.btn_1).setOnClickListener { toast() }
        findBtn(R.id.btn_2).setOnClickListener { toast() }
        findBtn(R.id.btn_3).setOnClickListener { toast() }
        findBtn(R.id.btn_4).setOnClickListener { toast() }
        findBtn(R.id.btn_5).setOnClickListener { toast() }

        tv_1 = findViewById(R.id.tv_prize_1)
        tv_2 = findViewById(R.id.tv_prize_2)
        tv_3 = findViewById(R.id.tv_prize_3)
        tv_4 = findViewById(R.id.tv_prize_4)
        tv_5 = findViewById(R.id.tv_prize_5)
    }

    fun toast(){
        AppUtil.toast("碎片不足!")
    }

    override fun initData() {
        val info = zpActivity.mInfo!!
        tv_1.text = WORLD + info.iphone12Pro
        tv_2.text = WORLD + info.hwMate40
        tv_3.text = WORLD + info.xiaomi10
        tv_4.text = WORLD + info.oppoX
        tv_5.text = WORLD + info.vivoX60
    }
}